//
//  FlutterWakeLockImpl.swift
//  Runner
//
//  Created by 莫华军 on 2024/9/21.
//

import Foundation
import Flutter

//文字绘制
class FlutterWakeLockImpl {
    static let sharedInstance = FlutterWakeLockImpl()
    private var methodChannel: FlutterMethodChannel?
    private  init() {
        
    }
    
    func setFlutterBinaryMessenger(binaryMessenger:FlutterBinaryMessenger){
        //文字相关的本地方法
        methodChannel = FlutterMethodChannel(name: "lib_wake_lock", binaryMessenger: binaryMessenger)
        methodChannel?.setMethodCallHandler { (call:FlutterMethodCall, result:@escaping FlutterResult) in
            
            if (call.method == "enable") {
                UIApplication.shared.isIdleTimerDisabled = true
            }else if(call.method == "disable"){
                UIApplication.shared.isIdleTimerDisabled = false
            }else if(call.method == "getPlatformVersion"){
                result("iOS " + UIDevice.current.systemVersion)
            }
        }
    }


}
